﻿@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "门诊发药统计";
    Layout = "~/Views/Shared/_Index.cshtml";
    var reportUrl = Newtouch.Core.Common.Utils.ConfigurationHelper.GetAppConfigValue("ReportUrl");
}
<style>
    #btn_print {
        background-color: #fff;
        color: #00a9ea;
        font-weight: bolder;
    }
</style>
<form id="form1">
    <div class="panel panel-default">
        <div class="panel-heading">搜索</div>
        <div>
            <table class="form">
                <tr>
                    <th class="formTitle ">开始日期:</th>
                    <td class="formValue">
                        <input id="startTime" type="text" class="form-control input-wdatepicker " value="@DateTime.Now.ToString("yyyy-MM-dd 00:00")" on onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm' })" />
                    </td>
                    <th class="formTitle">结束日期：</th>
                    <td class="formValue">
                        <input id="endTime" type="text" class="form-control input-wdatepicker " value="@DateTime.Now.AddHours(1).ToString("yyyy-MM-dd HH:mm")" on onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm' })" />
                    </td>
                    <th class="formTitle">输入码：</th>
                    <td class="formValue">
                        <input id="txtSRM" type="text" class="form-control" placeholder="姓名/卡号/发票号" />
                    </td>
                    <td class="formTitle">
                        <input type="button" id="btn_search" class="btn btn-primary" value="查询" style="margin-left:10px;" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="ui-layout" id="dv_layout" style="width: 100%; height: 100%;">
        <iframe class="ui-layout-center" style="width:100%; height: 100%;" id="if_data" name="if_data" scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
    </div>
</form>
<script>
    $(function () {
        $('#if_data').css('height', $(window).height() - 85);
        //查询
        $("#btn_search").click(function () {
            @*var url =
                "../../Report/PrintReport?type=DrugDeliveryStatistics&param=Organizeid=@ViewBag.OrganizeId|yfbmCode=@Constants.CurrentYfbm.yfbmCode" +
                    "|kssj=" +
                    $('#startTime').val() +
                    "|jssj=" +
                    $('#endTime').val() +
                    "|keyword=" +
                    ($('#txtSRM').val() === "" ? "n" : $('#txtSRM').val());
            $("#if_data").attr('src', url);*@

             var yfcode = "@Newtouch.Infrastructure.Constants.CurrentYfbm.yfbmCode";
            var uri = '@reportUrl' + "?tempCode=1309" + "&hospitalCode=" + '@ViewBag.OrganizeId' + "&yfbmCode=" + yfcode;
            uri += "&kssj=" + $('#startTime').val() + "&jssj=" + $('#endTime').val() + "&keyword=" + $("#txtSRM").val() ;

            $("#if_data").attr('src', uri);
        });
        $("#btn_search").trigger("click");
    });


    //回车事件绑定
    $(document).keyup(function (event) {
        if (event.keyCode ===13) {
            $("#btn_search").trigger("click");
        }
    });

</script>